package com.example.demo.controller;

import com.example.demo.VO.ResultVO;
import com.example.demo.pojo.MessageEntity;
import com.example.demo.pojo.UserEntity;

import com.example.demo.service.AdmainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class AdminController {
    @Resource
    AdmainService admin;


    /**
     * 获取用户列表接口
     *
     * @return list(question)问题的json列表
     */
    @GetMapping(value = "/getUseList")

        public ResultVO getUserList() {

            Map json = new HashMap();
            ResultVO resultVO = new ResultVO();
            ;
            List<UserEntity> list = admin.getAllUser();
            json.put("users", list);
            resultVO.setData(json);
        /**
         * vedio
         */
        return resultVO;
    }


    @GetMapping(value = "/getMessage")

    public ResultVO getMessage() {
        Map json = new HashMap();
        ResultVO resultVO = new ResultVO();
        List<MessageEntity> list = admin.getAllMessage();
        json.put("Message", list);
        resultVO.setData(json);
        return resultVO;
    }


}









